package com.itboye.hutouben.activity.qianbao;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.hutouben.R;
import com.itboye.hutouben.base.BaseActivity;
import com.itboye.hutouben.presenter.SystemMessgeAPresenter;
import com.itboye.hutouben.util.OnPasswordInputFinish;
import com.itboye.hutouben.util.PasswordView;

import java.util.Observable;
import java.util.Observer;

/**
 * 设置支付密码
 */
public class ZhiFuPassSheZhiActivity extends BaseActivity implements Observer {
    TextView add_shap_title_tv, add_lift_tv;
    ImageView close_icon;

    PasswordView pwdView;// 支付密码
    String paypent_pass;
    RelativeLayout titlebar;
    SystemMessgeAPresenter presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zhi_fu_pass_she_zhi);
        add_shap_title_tv.setVisibility(View.GONE);
        add_lift_tv.setText(R.string.shezhi_zhifu_pass);
        final PasswordView pwdView = (PasswordView) findViewById(R.id.pwd_view);

        // 添加密码输入完成的响应
        pwdView.setOnFinishInput(new OnPasswordInputFinish() {
            @Override
            public void inputFinish() {
                // 输入完成后跳转
                // 也就是说——>实现你的交易逻辑什么的在这里写

                paypent_pass = pwdView.getStrPassword();
                Intent intent = new Intent(ZhiFuPassSheZhiActivity.this, ZhiFuPassSheZhiTwoActivity.class);
                intent.putExtra("pass", paypent_pass);
                Log.d("pwd_view", paypent_pass);
                startActivity(intent);

                finish();
            }
        });
    }

    @Override
    protected void onInit() {


    }

    @Override
    protected void onReadIntent(Bundle bundle) {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.close_icon:
                finish();
                break;

            default:
                break;
        }
    }

    @Override
    public void update(Observable observable, Object data) {

    }
}
